//package com.otitan.forest.right.consumers;
//
//import com.alibaba.fastjson.JSONObject;
//import com.otitan.forest.right.entity.BssForestRightInfoEs;
//import com.otitan.forest.right.repository.BssForestRightInfoRepository;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.ExchangeTypes;
//import org.springframework.amqp.rabbit.annotation.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
///**
// * @Description:  elasticsearch 消费者 数据同步至 elasticsearch 中
// * @Author: jiachangsen   BssForestRightInfoProducers
// * @CreateDate: 2020/08/05 20:03
// * @UpdateUser: jiachangsen
// * @UpdateDate: 2020/08/05 20:03
// * @UpdateRemark: 修改内容
// * @Version: 1.0
// */
//
//@Slf4j
//@RabbitListener(
//        bindings = @QueueBinding(
//                value = @Queue(value = "${rabbitmq.config.queue.elasticsearchName}", autoDelete = "true"),
//                exchange = @Exchange(value = "${rabbitmq.config.exchange}", type = ExchangeTypes.FANOUT))
//)
//@Component
//public class EsConsumers {
//
//    @Autowired
//    private BssForestRightInfoRepository bssForestRightInfoRepository;
//    /**
//     * 设置监听方法
//     *  @RabbitHandler 声明监听方法是下面的 isDefault属性是默认false接受的完整对象，true接受body体
//     *
//     * @param msg
//     */
//    @RabbitHandler(isDefault = true)
//    public void process(String msg) {
//
//        log.debug("\n【消费者】 - 【elasticsearch】，收到消息 >>> {}", msg);
//        BssForestRightInfoEs entity = JSONObject.parseObject(msg, BssForestRightInfoEs.class);
//        bssForestRightInfoRepository.save(entity);
//    }
//}
